#ifndef __CMemoryStream_H__
#define __CMemoryStream_H__

#include <lampe/stream/IMemoryStream.h>



namespace lampe{
namespace stream{
class CMemoryStream:public IMemoryStream{
private:
	u32 allocated;
	u32 uses;
	void*Data;
	bool free_on_destroy;
	u32 Position;
	void checkSize(u32 needSize);
public:
	virtual u32 position();
	virtual void position(u32 position);
	virtual u32 size();
	virtual bool eof();
	virtual u32 read(void* buffer, u32 size);
	virtual u32 write(void* buffer, u32 size);
	virtual void*data();
	virtual void data(void*begin,irr::u32 size,bool _free_on_destroy=true);
	virtual void clear();
	CMemoryStream();
	~CMemoryStream();
};

IMemoryStream*createMemoryStream();

}//namespace stream
}//namespace lampe
#endif
